var resultData = JSON.parse(localStorage.getItem('resultData'));
console.log(resultData);

var defaultData = {
    q1: {
        title: '1. 每个月下发多少次微信报？',
        option: [{ name: '1次', value: resultData.send_frequency.once.count, percent: resultData.send_frequency.once.percentage },
        { name: '2次', value: resultData.send_frequency.twice.count, percent: resultData.send_frequency.twice.percentage },
        { name: '3次', value: resultData.send_frequency.thrice.count, percent: resultData.send_frequency.thrice.percentage },
        { name: '4次', value: resultData.send_frequency.quartic.count, percent: resultData.send_frequency.quartic.percentage }]
    },
    q2: {
        title: '2. 通常情况下你是周几下发微信报的？',
        option: [{ name: '周一', value: resultData.send_date.Monday.count, percent: resultData.send_date.Monday.percentage },
        { name: '周二', value: resultData.send_date.Tuesday.count, percent: resultData.send_date.Tuesday.percentage },
        { name: '周三', value: resultData.send_date.Wednesday.count, percent: resultData.send_date.Wednesday.percentage },
        { name: '周四', value: resultData.send_date.Thursday.count, percent: resultData.send_date.Thursday.percentage },
        { name: '周五', value: resultData.send_date.Friday.count, percent: resultData.send_date.Friday.percentage }]
    },
    q3: {
        title: '3. 你会在什么时间下发微信报？',
        option: [{ name: '7:00-8:00', value: resultData.send_time_interval.between_7_To_8.count, percent: resultData.send_time_interval.between_7_To_8.percentage },
        { name: '12:00-13:00', value: resultData.send_time_interval.between_12_To_13.count, percent: resultData.send_time_interval.between_12_To_13.percentage },
        { name: '18:00-19:00', value: resultData.send_time_interval.between_18_To_19.count, percent: resultData.send_time_interval.between_18_To_19.percentage },
        { name: '其他时间', value: resultData.send_time_interval.others.count, percent: resultData.send_time_interval.others.percentage }]
    },
    q4: {
        title: '4.本次下发微信报之后至下次下发之前大概能做增长多少个粉丝？',
        option: [{ name: '0-500', value: resultData.increased_Fans.within_500.count, percent: resultData.increased_Fans.within_500.percentage },
        { name: '500-1000', value: resultData.increased_Fans.between_500_To_1000.count, percent: resultData.increased_Fans.between_500_To_1000.percentage },
        { name: '1000-1500', value: resultData.increased_Fans.between_1000_To_1500.count, percent: resultData.increased_Fans.between_1000_To_1500.percentage },
        { name: '1500以上', value: resultData.increased_Fans.greater_than_1500.count, percent: resultData.increased_Fans.greater_than_1500.percentage }],
        total: 3000
    },
    q5: {
        title: '5.目前公众号内有多少粉丝？',
        option: [{ name: '0-1万',value: resultData.total_Fans.within_10000.count, percent: resultData.total_Fans.within_10000.percentage },
        { name: '1万-5万', value: resultData.total_Fans.between_10000_To_50000.count, percent: resultData.total_Fans.between_10000_To_50000.percentage },
        { name: '5万-10万', value: resultData.total_Fans.between_50000_To_100000.count, percent: resultData.total_Fans.between_50000_To_100000.percentage },
        { name: '10万以上', value: resultData.total_Fans.greater_than_100000.count, percent: resultData.total_Fans.greater_than_100000.percentage }],
        total: 3000
    },
    result: {
        percent: resultData.conclusionResult.loss_rate,
        intPercent: '',
        score: resultData.conclusionResult.score,
        rank: resultData.conclusionResult.rank
    }
};
console.log(defaultData);
$('#statisticsContainer').append(_.template($('#focusTmp').html(), defaultData));
jQuery(document).ready(function () {
    jQuery('.skillbar').each(function () {
        jQuery(this).find('.skillbar-bar').animate({
            width: jQuery(this).attr('data-percent')
        }, 3000);
    });
});
var result = {
    percent: resultData.conclusionResult.loss_rate,
    intPercent: '',
    score: resultData.conclusionResult.score,
    rank: resultData.conclusionResult.rank
};
$('#resultTemp').append(_.template($('#result').html(), result));
var pieChart = document.getElementById('pieChart');
insertPie(pieChart);
function insertPie(pie) {
    var p = parseFloat(pie.textContent);
    var NS = "http://www.w3.org/2000/svg";
    var svg = document.createElementNS(NS, "svg");
    var circle = document.createElementNS(NS, "circle");
    var title = document.createElementNS(NS, "title");
    circle.setAttribute("r", 16);
    circle.setAttribute("cx", 16);
    circle.setAttribute("cy", 16);
    circle.setAttribute("stroke-dasharray", p + " 100");
    svg.setAttribute("viewBox", "0 0 32 32");
    title.textContent = pie.textContent;
    pie.textContent = '';
    svg.appendChild(title);
    svg.appendChild(circle);
    pie.appendChild(svg);
}